<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript">
function searchCustomer(){
	if($("#search_type").val()=='선택'){
		alert("검색 구분은 필수입니다");
		$("#search_type").focus();
		return false;
	}
	if($("#btn").val()==''){
		alert("내용을 입력해주세요");
		$("#btn").focus();
		return false;
	}
}
</script>
<style type="text/css">
 	
 	p {text-align:center; color:white; font-size: 40px; background-color: #F20C64;}
  	.headline {margin-top: 0px; margin-bottom: 10px;}
  	.headtext {font-weight: bolder; color:#F20C64; margin-top: 20px; margin-bottom: 0px; font-style: 돋음; }
</style>
<form method="post" action="/${initParam.context_root }/customer/searchCustomer.do" onsubmit="return searchCustomer()">
	<table>
		<tr align="center">
			<td>검색조건</td>
				<td>
					<select id="search_type" name="search_type" size="1" >
						<option>선택</option><option value="all">전체검색</option><option value="name">이름</option>
						<option value="birth">생년월일</option><option value="phone">핸드폰번호</option>
						<option value="address">주소</option><option value="joinDate">가입일</option>
					</select>
				<input id="btn" type="text" name="input" size="20">
				<button type="submit" class="btn btn-info btn-sm">검색</button>
			</td>
		</tr>
	</table>
</form><br><br>

<h3 class="headtext">회원정보 조회</h3>
<hr class="headline">
<table class="table table-bordered" id="customerListForm" border="1" >
		<tr align="center" style="background-color:#453949; color: white;">
			<td width="70px"><b>회원ID</b></td>
			<td width="70px"><b>회원이름</b></td>
			<td width="100px"><b>생년월일</b></td>
			<td width="160px"><b>이메일</b></td>
			<td width="100px"><b>Phone</b></td>
			<td width="200px"><b>주소</b></td>
			<td width="100px"><b>가입일</b></td>
		</tr>
		<c:forEach items="${requestScope.list }" var="customer">
		<tr align="center">
			<td>${customer.custId }</td>
			<td>${customer.name}</td>
			<td>${customer.birth}</td>
			<td>${customer.email}</td>
			<td>${customer.phone}</td>
			<td>${customer.address}</td>
			<td>${customer.joinDate}</td>
		</tr>
		</c:forEach>
		<tr>
			<td colspan="7" align="center">
				<button><a href="/${initParam.context_root }/customer/customerView.do" style="color: #453949; text-decoration: blink;">회원목록엑셀다운로드</a></button>
			</td>
		</tr>
	</table>
